<{include file="header.tpl"}>
<div class="comBox">
    <div class="comHeader">
        <form action="" method="GET">
            <input type="hidden" name="ct" value="<{request_em key='ct'}>" />
            <input type="hidden" name="ac" value="<{request_em key='ac'}>" />
            <b>日期</b>
            <input type='text' name='start_date' id="datepicker1" style="width: 75px;" value="<{$start_date}>" />
            ~
            <input type='text' name='end_date' id="datepicker2" style="width: 75px;" value="<{$end_date}>" />
            &nbsp;&nbsp;
            <b>服务器ID:</b>
            <input type='text' name='book_id' style='width:120px;' class = "tt"  value="<{$book_id}>" />
            &nbsp;&nbsp;
            <b>书籍名:</b>
            <input type='text' name='book_name' style='width:120px;' class = "tt"  value="<{$book_name}>" />
            &nbsp;&nbsp;
            <b>书籍后缀:</b>
            <input type='text' name='book_suffix' style='width:120px;' class = "tt"  value="<{$book_suffix}>" />
            &nbsp;&nbsp;
            <input type="submit" value = "查询" class = "sub">
        </form>
    </div>
    <div class="comTable">
        <form action="" method="POST" id="form1" >
            <table class="tableSort" >
                <tr class="title">
                    <td ><input type="checkbox" name = "" value ="" rel = "parent">ID序号| BOOK_ID</td>
                    <td >书籍名|后缀</td>
                    <td >作者名</td>
                    <td title="whowant2@163.com@q8XX">请求发<a href="http://mail.163.com/" target="_blank">邮件</a>|读取附件地址 | 保存至本地</td>
                    <td >添加时间</td>
                    <td width="120"> 管理 </td>
                </tr>

                <{if !empty($list)}>
                <{foreach from=$list item=v}>
                <tr>
                    <td><input type = "checkbox" name = "ids[]" value="<{$v.id}>" rel ="child" /><{$v.id}> | <{$v.book_id}> </td>
                    <td> <{$v.book_name}> | <{$v.book_suffix}> </td>
                    <td> <{$v.book_author}> </td>
                    <td><a class="ajax_send_url" atturl="" attbookid="<{$v.book_id}>" attid="<{$v.id}>" href="javascript:;"><{if $v.caiji_is_call}>重发(<{$v.caiji_is_call}>)<{else}>请求发送<{/if}></a>
                    =&gt;
                    <a class="ajax_read_email"  attbookid="<{$v.book_id}>" href="javascript:;"><{if $v.caiji_read_email_url}>已存在<{else}>采集附件地址 <{/if}></a>
                    =&gt;
                    
                        <{if $v.caiij_ok}>
                            <a href="<{$v.book_path}>" >本地打开</a> 
                        <{else}>
                            <a class="ajax_down_url" attid="<{$v.id}>" href="javascript:;">采集到服务器</a>
                        <{/if}>
                    </td>
                    <td> <{$v.add_date}> </td>
                    <td> <a href="?ct=book&ac=edit&id=<{$v.id}>" class="edit">修改</a><a href="?ct=book&ac=del&id=<{$v.id}>" class="delete" onclick="return confirm('确定删除该用户?')">删除</a> </td>
                </tr>
                <{/foreach}>
                <{/if}>
                <tr>
                    <td colspan="9" align="center" bgcolor="#FFFFFF"><{$pages}></td>
                </tr>

            </table>

        </form>
    </div>
</div>
<{include file="footer.tpl"}>
<script>
    $(function(){
        $(".ajax_send_url").click(function(){
            var book_id = $(this).attr('attbookid');
            var id = $(this).attr('attid');
            t = $(this);

            $.ajax({
                url: "/index.php?ct=book&ac=ajax_call_send",
                dataType: "json",
                data: {"book_id":book_id,"id":id},
                type: "post",
                success: function(data) {
                    if (data.errcode == 0) {

                        t.hide();
                        if(confirm(data.msg+'并刷新页面？')){
                            window.location.reload();
                        }

                    } else {
                        alert(data.msg);

                    }
                },
                error: function(xhr, type) {
                    alert("提交失败，请重新提交");
                }
            })
        });

        $(".ajax_read_email").click(function(){

            $.ajax({
                url: "/index.php?ct=book&ac=ajax_read_email",
                dataType: "json",
                data: {},
                type: "post",
                success: function(data) {
                    if (data.errcode == 0) {
                        if(confirm(data.msg+'并刷新页面？')){
                            window.location.reload();
                        }


                    } else {
                        alert(data.msg);

                    }
                },
                error: function(xhr, type) {
                    alert("提交失败，请重新提交");
                }
            })
        })
        $(".ajax_down_url").click(function(){
            var id = $(this).attr('attid');
            $.ajax({
                url: "/index.php?ct=book&ac=ajax_down_book",
                dataType: "json",
                data: {"id":id},
                type: "get",
                success: function(data) {
                    if (data.errcode == 0) {
                        if(confirm(data.msg+'并刷新页面？')){
                            window.location.reload();
                        }lert(data.msg);

                    } else {
                        alert(data.msg);

                    }
                },
                error: function(xhr, type) {
                    alert("提交失败，请重新提交");
                }
            })
        })


    })
</script>
